<?php
	if (!empty($_GET['user_id']))
		$id = $_GET['user_id'];
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>MetroGenerador - Index Usuario</title>
<link href="../estilos/style_index.css" rel="stylesheet" type="text/css" media="screen" />
<link href="../estilos/style_registry.css" rel="stylesheet" type="text/css" media="screen" />
<link href="../estilos/style_filebutton.css" rel="stylesheet" type="text/css" media="screen" />
<script src="http://code.jquery.com/jquery-1.8.3.js"></script>
<script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js"></script>
<script src="../controladores/javascripts/dynamicContentFunctions.js"> </script>
</head>
<body>
<div id="header">
	<div id="logo"><img src="../imagenes/logo.png" alt="" width="335" height="53"/></div>
	<div id="menu">
		<ul> <li><a href="#" style="color:#FFF">Bienvenido: <?php
			 
				include_once '../controladores/ControladorUsuarios.php';
	
					$command = new ControladorUsuarios();
	
					echo $command->obtainUserName($id);
			
			?></a>
                <ul> <li><a href="login.html" style="color:#FFF;"> > Cerrar Sesi&oacute;n</a></li></ul>
            </li>           
        </ul>

		<ul id="feed">
		  <li></li>
			<li></li>
		</ul>
	</div>
	
</div>
<!-- end header -->
<div id="wrapper">
	<!-- start page -->
	<div id="page">
<div id="sidebar1" class="sidebar">
		<form method="post" action="app_create.php?id=<?php echo $id?>" enctype="multipart/form-data">
			<ul>
			  <li>
				<h2>Nueva Aplicaci&oacute;n</h2>
				  <ul>
				    <div class="subfieldsset">
				      <table width="200" border="0" align="center">
				        <tr>
				          <td colspan="2">&nbsp;</td>
			            </tr>
				        <tr>
				          <td colspan="2">- Nombre de la aplicaci&oacute;n:</td>
			            </tr>
				        <tr>
				          <td colspan="2"><input type="text" size="30" id="app_name" name="app_name"/></td>
			            </tr>
				        <tr>
				          <td colspan="2">- Descripci&oacute;n</td>
			            </tr>
				        <tr>
				          <td colspan="2"><textarea id="app_description" name="app_description"></textarea></td>
			            </tr>
				        <tr>
				          <td colspan="2">- Versi&oacute;n</td>
			            </tr>
				        <tr>
				          <td colspan="2"><input type="text" size="30" id="app_version" name="app_version"/></td>
			            </tr>
                        <tr>
				          <td colspan="2"> - Icono de la aplicaci&oacute;n</td>
			            </tr>
				        <tr>
				          <td><div id='file_browse_wrapper'>
		<input type='file' id='files' name='files[]'/>
	    </div></td>
				          <td>&nbsp;</td>
			            </tr>
                        <tr>
				          <td colspan="2" align="center"><output id="list"></output>

<script>
  function handleFileSelect(evt) {
    var files = evt.target.files; 
	
    for (var i = 0, f; f = files[i]; i++) {
	  
      if (!f.type.match('image.*')) {
        continue;
      }

      var reader = new FileReader();
	 
      reader.onload = (function(theFile) {
        return function(e) {
          var span = document.createElement('span');
		  
          span.innerHTML = ['<img class="thumb" name = "imageUploaded" id = "imageUploaded" src="', e.target.result,'" title="', escape(theFile.name), '"/>'].join('');
          document.getElementById('list').insertBefore(span, null);
        };
      })(f);	  
      reader.readAsDataURL(f);
    }
  }
 document.getElementById('files').addEventListener('change', handleFileSelect, false);
</script></td>
			            </tr>
                                                <tr>
				          <td colspan="2" align="justify"><input type="image" style="border:none" onClick="return validate();" src="../imagenes/sumit_createapp.png" alt="" align="left" width="73" height="37"/></td>
			            </tr>
</table>
</div>
				  </ul>
			  </li>
			</ul>
            </form>
		</div>
		<div id="content">
		  <div class="post">
		    <?php            	
			   
			  		include_once '../controladores/ControladorAplicaciones.php';
	
					$command = new ControladorAplicaciones();
	
					echo $command->searchUserApplications($id);
				
				?>
			  <p>&nbsp;</p>
			  <p class="links">&nbsp;</p>
			</div>
		  </div>
</div>
		<!-- end content -->
		<!-- start sidebars -->
		<div style="clear: both;">&nbsp;</div>
	</div>
	<!-- end page -->
</div>
<div align=center></div>
</body>
</html>